<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="dist/vue.js"></script>
</head>
<body>
  <div id="app">
    <div id="count"></div>
    <button onclick="addJsFn()">js加1</button>
    <button @click="count += 1">count加1 {{ count }}</button>
    <button @click="add($event)">我是事件处理函数</button>
</div>
</body>
<script>
    var a = 0;

    var app = new Vue({
        el: '#app',
        data: {
            count: 0
        },
        methods: {
            add(event) {
                //  @click="add"add没有小括号时,event为事件对象
                // @click="add()" 有小括号时,event为undefined
                // @click="add($event)" 需要事件对象时,()里传入$event
                console.log(event);         
            }
        }
    });

    function addJsFn() {
        a++;
        document.getElementById('count').innerHTML = a;
    }
</script>
</html>